<?php

declare(strict_types=1);

namespace App\Request\auth;

use Hyperf\Validation\Request\FormRequest;

/**
 * 管理员验证器
 */
class AdminRequest extends FormRequest
{


    protected array $scenes = [
        'updated' => [
            'nickname',
            'account',
            'avatar',
            'role_id',
        ],
        'authorize'=>[
            'account','password'
        ]

    ];
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'nickname' => 'required',
            'account' => 'required',
            'password' => 'required',
            'avatar' => 'required',
            'role_id'=>'required|array',
        ];
    }

    public function messages(): array
    {
        return [
            'nickname.required' => '请输入昵称',
            'account.required' => '请输入账号',
            'password.required' => '请输入密码',
            'avatar.required' => '请上传头像',
            'role_id.required' => '请选择角色',
            'role_id.array' => '选择的角色格式错误',
        ];
    }
}
